<script>
export default {
  onLaunch: function() {
    console.log('App Launch');
  },
  onShow: function() {
    console.log('App Show');
  },
  onHide: function() {
    console.log('App Hide');
  }
}
</script>

<script setup>
import { onMounted } from 'vue'
import { useAuthStore } from './store/auth'

const authStore = useAuthStore()

onMounted(() => {
  // 初始化 auth store
  authStore.initFromStorage()
  
  // 检查登录状态，如果需要跳转
  if (!authStore.isLoggedIn) {
    uni.redirectTo({
      url: '/pages/login/login'
    })
  }
})
</script>

<template>
  <!-- 移除 router-view，小程序不使用它 -->
  <view></view>
</template>

<style lang="scss">
/* 全局样式 */
page {
  background-color: $u-bg-color;
  font-size: $u-font-size-base;
}
</style>